package com.jiangxjsy.admin.client;

import com.jiangxjsy.core.wrap.Result;
import com.jiangxjsy.core.wrap.ResultBuilder;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * wukong-crm-master
 * 蒋胜宇
 * 2025/6/8 2:11
 */

@FeignClient(name = "email", fallback = EmailClient.EmailClientFallback.class)
public interface EmailClient {
    /**
     * 获取邮箱 id
     *
     * @param userId 用户 id
     * @return 邮箱 id
     */
    @PostMapping("/emailAccount/queryAccountId")
    Result<Integer> getEmailId(@RequestParam("userId") Long userId);


    @Component
    class EmailClientFallback implements EmailClient {
        /**
         * 获取邮箱 id
         *
         * @param userId 用户 id
         * @return 邮箱 id
         */
        @Override
        public Result<Integer> getEmailId(Long userId) {
            return ResultBuilder.ok(null);
        }
    }
}
